package com.sqx.modules.creation.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.creation.entity.dto.GetLabelListDto;
import com.sqx.modules.creation.entity.dto.UpdateLabelDto;
import com.sqx.modules.creation.service.LabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 标签表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024年09月07日
 */
@RestController
@RequestMapping("/system/label")
public class LabelController {
    @Autowired
    private LabelService labelService;

    /**
     * 获取标签列表
     * @return
     */
    @GetMapping("/getLabelList")
    public Result getLabelList(){
        return labelService.getLabelList();
    }

    /**
     * 修改标签
     * @param updateLabelDto
     * @return
     */
    @PostMapping("/updateLabel")
    public Result updateLabel(@Valid@RequestBody UpdateLabelDto updateLabelDto){
        return labelService.updateLabel(updateLabelDto);
    }

    /**
     * 根据id删除标签
     * @param labelIds
     * @return
     */
    @PostMapping("/deleteLabelById/{labelIds}")
    public Result deleteLabelById(@PathVariable Integer[] labelIds){
        return labelService.deleteLabel(labelIds);
    }

}

